Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on jquery-form #35240

Merged
merged 8 commits into from
Oct 22, 2024
Merged

Remove dependency on jquery-form #35240

merged 8 commits into from
Oct 22, 2024

Conversation

orangejenny
Copy link
Contributor

@orangejenny orangejenny commented Oct 21, 2024

Technical Summary

This dependency isn't really pulling its weight. I've thought about removing it before, and this morning @gherceg and I ran into an issue integrating it with webpack, so now seemed like a good time to kill it.

The API is pretty small: https://github.com/jquery-form/form

We primarily use ajaxSubmit, and also use resetForm in a couple of places. I imagine this library was more useful when we started using it, but now we can use native js functionality that's approximately as concise.

https://dimagi.atlassian.net/browse/SAAS-16090

Safety Assurance

Safety story

These are fairly minor changes on ~5 areas in HQ (although the CRUD view is used in a couple of places). I tested each of them locally.

Automated test coverage

Unlikely

QA Plan

Not requesting QA

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@orangejenny orangejenny added the product/invisible Change has no end-user visible impact label Oct 21, 2024
@dimagimon dimagimon added dependencies Pull requests that update a dependency file Risk: High Change affects files that have been flagged as high risk. labels Oct 21, 2024
Copy link
Contributor

@gherceg gherceg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for removing this! Left a couple of questions.

let formData = new FormData($createForm.get(0));
formData.set("action", "create");
$.ajax({
method: 'POST',
dataType: 'json',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite follow why we keep dataType: 'json' in this request but remove it in the other modified request in this file? Same goes for the b5 version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are spurious changes, I must have made them while troubleshooting and then not changed them back. Reading the docs now, it'd be fine to leave off dataType altogether in this code (for a default value, the docs say it makes an intelligent guess).

@orangejenny orangejenny merged commit 84934ca into master Oct 22, 2024
12 checks passed
@orangejenny orangejenny deleted the jls/drop-ajax-submit branch October 22, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file product/invisible Change has no end-user visible impact Risk: High Change affects files that have been flagged as high risk.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants